package com.bigcat.gulimall.demo.java8.compiler;

import java.io.InputStream;
import java.lang.reflect.Method;
import java.lang.reflect.Parameter;
import java.net.URL;

/**
 * @author sufer_yuan
 * @since 2022/2/7
 *
 */
public class ParameterNames {
    public static void main(String[] args) throws Exception {
        Method method = ParameterNames.class.getMethod("main", String[].class);

        URL resource = ParameterNames.class.getClassLoader().getResource("application.yml");

        InputStream inputStream = resource.openStream();
        byte[] buffer = new byte[128];
        int len;
        while ((len = inputStream.read(buffer)) != -1) {
            System.out.println(new String(buffer, 0, len));
        }

        for (final Parameter parameter : method.getParameters()) {
            System.out.println("Parameter: " + parameter.getName());
        }
    }

}
